#include<stdio.h>
#include<math.h>
int IsPrime(int x);
int main()
{	   	 	     
    int m = 3;
    int sum = 2;
    int n;
    scanf("%d", &n);
    for (m = 3; m <= n; m++)
    {	   	 	     
        if (IsPrime(m))
        {	   	 	     
            sum += m;
        }
    }
    printf("%d", sum);
    return 0;
}	   	 	     
int IsPrime(int x)
{	   	 	     
    int i, flag = 1;
    int squareRoot = (int)sqrt(x);
    if (x <= 1)
    {	   	 	     
        flag = 0;
    }
    for (i = 2; i <= squareRoot && flag; i++)
    {	   	 	     
        if (x % i == 0)
        {	   	 	     
            flag = 0;
        }
    }
    return flag;
}	   	 	     
